<?php
   	include_once "../funciones.php";
    $con=conectar();
    $today = date("d-M-Y");
    $fallo=false;
   try {
        $con->beginTransaction();
        $OID=getOIDNuevo('INFORMES_PRESTAMOS', 'OID_INF');
        $sql="INSERT INTO INFORMES_PRESTAMOS VALUES  (".$OID.", '".$today."', ".$_REQUEST['OID_CAM'].", 1)";
        $stmt = $con->prepare($sql);
        $stmt->execute();
		$stmt = $con->prepare("commit");
	    $stmt->execute();
	}catch(PDOException $e ) {
			echo "error: ".$e->GetMessage();
            $con->rollBack();
             header( 'Location: insertarPrestamos.php?exito=2');
   	        $fallo=true;

	}
    if($fallo==false)
        header( 'Location: insertarPrestamos.php?exito=1&oid_inf='.$OID.'&OID_CAM='.$_REQUEST['OID_CAM']);


   ?>